
/*

DEPENDENCIES:
-------------
(none)
-------------


IN THIS FILE:
-------------
ext.get_sibling
-------------

*/

Gimme.ext.get_sibling = function(_distance, n)
{
	var elem = this[n || 0];
	var sib = elem;
	
	if (_distance !== 0)
	{
		var sibling = _distance > 0 ? 'nextSibling' : 'previousSibling';
		var count = Math.abs(_distance);

		var i = 0;
		while (i < count)
		{
			sib = sib[sibling];
			if (!sib)
			{
				break;
			}
			if (sib.nodeType === 1)
			{
				i++;
			}
		}
	}
	
	return Gimme(sib);
};
//[AltSyntax]Gimme.ext.getSibling = Gimme.ext.get_sibling;